<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%String path=request.getContextPath();String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";if(session.getAttribute("user")==null){response.sendRedirect(basePath);};%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<base href="<%=basePath%>">
	<title><s:text name="sys.app_title" /></title>
	<%@include file="../include/contentheader.jsp"%>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
	<link rel="stylesheet" type="text/css" href="css/dtree.css"/>
	<link rel="stylesheet" type="text/css" href="css/main.css"/>
	<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="js/app.js"></script>
	<script type="text/javascript" src="js/dtree.js"></script>
	<script type="text/javascript" src="dwr/engine.js"></script>
	<script type="text/javascript" src="dwr/util.js"></script>
	<script type="text/javascript">
		function showdepartment(){
			var x = window.showModalDialog("/SSS/page/basic/depTree_1.jsp",null,"dialogWidth=600px;dialogHeight=350px");
			var uid=x.substring(0, x.indexOf(",", 0));
			var uname=x.substring((x.indexOf(",", 0)+1), x.length);
				$('input#Departmentsname').val(uid);
				$('input#staff').val(uname);
		}
		function validate(){
			alert("undasd");
			if($('div#usernameMessage').html()!=""){
				return false;
			}else{
				return true;
			}
		}
		$(document).ready(function(){
			$('input#un').blur(function(){
				if($(this).val().length==0){
					$('div#usernameMessage').html("用户名不能为空");
				}
			}).focus(function(){
				$('div#usernameMessage').html("");
			});
		});	
		function doBack(){
			location.href="findAllUser.action";
		}
	</script>
  </head>
  <body>
<form action="updateUser.action" method="post" onsubmit="return validate();">
<div class="mainContainer">
	<div class="headerTitle"><s:property value="navStr" /></div>
	<div class="dataDivLeftNoTree">

 <table class="formTable" border="0" cellspacing="0" cellpadding="0">
	<tr class="operatorAction">
		<td>
			<!-- 功能性操作 -->
			<!--<input type="button" onclick="location.href='tmplt-list?FN=<s:property value='FN' />'" value="刷新" />
			<input type="button" onclick="location.href='tmplt-add?FN=<s:property value='FN' />&opt=0'" value="新增" />
			<input type="button" onclick="location.href='tmplt-del?FN=<s:property value='FN' />'" value="删除" />
			<input type="button" onclick="location.href='tmplt-export?FN=<s:property value='FN' />'" value="导出" />
			<input type="text" class="qryTxt" /><input type="button" style="margin-left:1px;" value="查询" />
			-->
			<input id="sbm" type="submit" value="提交" />
	        <input type="button" onclick="doBack();" value="返回" />
		</td>
	</tr>
    <tr>
		<td class="formData">
			<table class="dataTable" border="0" cellpadding="0" cellspacing="1">
				<s:iterator var="s" value="sysUsers">
	          <tr class="dataRow">
	            <td>用户账号：<input type="text" name="qm" id="qm" value="<s:property value="#s.userCode"/>" readonly="readonly" style="background-color:#cccccc;"/></td>
	            <td id="usercodetest"></td>
	          </tr>
	          <tr class="dataRow">
	            <td>用户名：<input id="un" type="text" name="un" id="username" value="<s:property value="#s.userName"/>"/></td>
	            <td><div id="usernameMessage" style="display:inline;color:red;"></td>
	          </tr>
	         <tr class="dataRow">
	            <td>权限模板：<select id="userrole" name="templatesname">
	            	  <s:iterator var="t" value="sysTemplates">
	            	  <s:if test="#s.templateCode==#t.templateCode">
	            	  	<option value="<s:property value="#t.templateCode"/>"  selected="selected"><s:property value="#t.templateName"/></option>
	            	  </s:if><s:else>
	            	  	<option value="<s:property value="#t.templateCode"/>"><s:property value="#t.templateName"/></option>
	            	  </s:else>
	            	  </s:iterator>
	            </select></td>
	            <td><!--部门：<select id="userpepart" name="Departmentsname">
	            	  <s:iterator var="d" value="departments">
	            		  <s:if test="#s.deptCode==#d.depid">
	            	  			<option value="<s:property value="#d.depid"/>"  selected="selected" ><s:property value="#d.depname"/></option>
	            	 		</s:if><s:else>
	            	 			<option value="<s:property value="#d.depid"/>"><s:property value="#d.depname"/></option>
	            	 		</s:else>
	            	  </s:iterator>
	            </select>--></td>
	          </tr>
	           <tr class="dataRow">
	            <td>持有人：
	            	<input type="hidden" id="Departmentsname" name="Departmentsname" value="<s:property value="#s.department.depid"/>"/>
	            <input type="hidden" id="Departmentsname" name="Departmentsname" />
	            <input type="text" id="staff" name="staffname" value="<s:iterator var="x" value="staffs"><s:if test="#x.staid==#s.staid"><s:property value="#x.staname"/></s:if></s:iterator>" readonly="readonly"/><img src="images/showDep.gif" onclick="showdepartment()" style="cursor: pointer;" alt="选择上级部门" title="员工" />
	            <!--<select id="userstaff" name="staffname">
	            	  <s:iterator var="a" value="staffs">
	            	 	 <s:if test="#s.staid==#a.staid">
	            	  		<option value="<s:property value="#a.staid"/>"  selected="selected"><s:property value="#a.staname"/></option>
	            	  	</s:if><s:else>
	            		  	<option value="<s:property value="#a.staid"/>"><s:property value="#a.staname"/></option>
	            	  	</s:else>
	            	  </s:iterator>
	            </select>-->
	            </td>
	            <td>
	            账号状态：<select id="userstatus" name="sas">
	       	     <s:if test="#s.status==\"A\"">
	            	  <option value="A" selected="selected">在用</option>
	            	  <option value="D">停用</option>
	            	  </s:if><s:else>
	            	  <option value="A">在用</option>
	            	  <option value="D" selected="selected">停用</option>
	            	  </s:else>
	            </select>
	            </td>
	          </tr>
	          </s:iterator>
			</table>
		</td>
	</tr>
</table>
</div>
</div>
</form>
</body>
</html>
